package cn.jingyinghui.nimingneibulei;


interface InnerInterface {
    void doSomething();
}


class InnerInterfaceImpl implements InnerInterface{

    @Override
    public void doSomething() {
        System.out.println("我是一个成员方法内部类");
    }
}

public class NimingNeibuLei {

    public static void main(String[] args) {

        //匿名内部类
        System.out.println("匿名内部类:");
        InnerInterface oi = new InnerInterface() {
            @Override
            public void doSomething() {
                System.out.println("我是匿名内部类");
            }
        };
        oi.doSomething();

        //用lambda实现
        System.out.println("lambda实现:");
        InnerInterface oi2=()-> System.out.println("我是lambda实现的");
        oi2.doSomething();


        //用lambda实现,双冒号看看
//        System.out.println("lambda实现，基于双冒号:");
//        InnerInterface oi3=()-> System.out.println("我是lambda实现的");
//        oi2.doSomething();


        //普通类
        System.out.println("普通类:");
        InnerInterfaceImpl innerInterface=new InnerInterfaceImpl();
        innerInterface.doSomething();





    }



}
